#ifndef UTIL_H
#define UTIL_H
#include <QTime>

int timeToSecs(QTime time)
{
    return (time.second() + time.minute() * 60);
}

QString timeFromSecs(int secs)
{
    QTime time(0, secs / 60, secs % 60, 0);
    return time.toString("m:ss");
}

QString extractVideoFromUrl(QString url)
{
    url = url.right(url.size()  - url.lastIndexOf("v=")-2);
    url = url.left(url.indexOf("&"));
    return url;
}

#endif // UTIL_H
